var prize_avideo_f4v_url = "http://flv.bn.netease.com/videolib3/1406/04/eyjqJ7394/HD/eyjqJ7394-mobile.mp4";
var prize_avideo_mp4_url = "http://flv.bn.netease.com/videolib3/1406/04/eyjqJ7394/HD/eyjqJ7394-mobile.mp4";
var prize_startImg_url = "img/prize1.png";

$(function() {

	var width = screen.width;
	//width = 1920; /////////////////控制页面大小
	if (width < 1440) {// 屏幕小于 1440的时候,page页面不再居中,保证sidebar可见
		$("#page").css({
			"margin-left" : "20px"
		});
	}
	
	width = width < 1300 ?  1300 : width; // 页面宽度最小值为1300
	
	var nav_height = width / 2000 * 82;
	//切图宽2000，高82
	var nav_ul_width = width / 2;

	nav_ul_width = nav_ul_width < 800 ? 800 : nav_ul_width;

	$("body").css({
		"width" : width
	});
	$("#banner>img").css({
		"width" : width
	});
	$("#nav").css({
		"height" : nav_height
	});

	$("#nav ul").css({
		"height" : nav_height,
		"line-height" : nav_height + "px",
		"width" : nav_ul_width
	});

	$("#nav img").css({
		"width" : width
	});

	var marstv_left = (width - 1000) / 2;
	$("#marstv").css({
		"left" : marstv_left
	});
	$("#razer").css({
		"left" : marstv_left + 200
	})

	var sidebar_left = $("#page").offset().left + $("#page").width() + 50;
	var sidebar_top = $("#page").offset().top + 50;

	$("#sidebar").css({
		"left" : sidebar_left,
		"top" : sidebar_top
	})

	$("#carousel_toolbar span").click(function(){
		$span = $(this);
		var left = -$span.index() * 530;
		
		
		
		if($(this).hasClass("active")){
			return;
		}
		$("#carousel_toolbar span.active").removeClass("active");
		
		$span.addClass("active");
		
		$("#carouselList").css({"left":left});
		
	})
	
	$("#sidebar .close").click(function(){
		//$("#sidebar").css({"display":"none"});
		$("#sidebar").hide();
	})
	
	nie.use(['nie.util.video'], function() {

		nie.util.video($('#prizeVideo'), {
			movieUrl : prize_avideo_f4v_url,
			mp4_movieUrl : prize_avideo_mp4_url,
			startImg : prize_startImg_url,
			width : 530,
			height : 284,
			bufferTime : 5,
			loopTimes : 0,
			wmode : "opaque"
		});

		
	});

})